using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using Condimar.Repository.Mapping;
using Condimar.Entities;

namespace Condimar.Repository
{
    public partial class DBCondimarContext : DbContext
    {
        static DBCondimarContext()
        {
            Database.SetInitializer<DBCondimarContext>(
                null
               //new DropCreateDatabaseAlways<DBCondimarContext>()
               );
        }

        public DBCondimarContext()
            : base("Name=DBCondimarContext")
        {
            this.Configuration.LazyLoadingEnabled = false;
            this.Configuration.ProxyCreationEnabled = false;
            this.Configuration.AutoDetectChangesEnabled = false;
        }

        public DbSet<Categoria> Categorias { get; set; }
        public DbSet<Cliente> Clientes { get; set; }
        public DbSet<Compra> Compras { get; set; }
        public DbSet<Comprobante> Comprobantes { get; set; }
        public DbSet<DetalleCompra> DetalleCompras { get; set; }
        public DbSet<DetalleVenta> DetalleVentas { get; set; }
        public DbSet<FormaPago> FormaPagoes { get; set; }
        public DbSet<Marca> Marcas { get; set; }
        public DbSet<Producto> Productoes { get; set; }
        public DbSet<Proveedor> Proveedors { get; set; }
        public DbSet<TipoComprobante> TipoComprobantes { get; set; }
        public DbSet<UnidadMedida> UnidadMedidas { get; set; }
        public DbSet<Vendedor> Vendedors { get; set; }
        public DbSet<Venta> Ventas { get; set; }
        public DbSet<ClienteJuridico> ClienteJuridico { get; set; }
        public DbSet<ClienteNatural> ClienteNatural { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new CategoriaMap());
            modelBuilder.Configurations.Add(new ClienteMap());
            modelBuilder.Configurations.Add(new CompraMap());
            modelBuilder.Configurations.Add(new ComprobanteMap());
            modelBuilder.Configurations.Add(new DetalleCompraMap());
            modelBuilder.Configurations.Add(new DetalleVentaMap());
            modelBuilder.Configurations.Add(new FormaPagoMap());
            modelBuilder.Configurations.Add(new MarcaMap());
            modelBuilder.Configurations.Add(new ProductoMap());
            modelBuilder.Configurations.Add(new ProveedorMap());
            modelBuilder.Configurations.Add(new TipoComprobanteMap());
            modelBuilder.Configurations.Add(new UnidadMedidaMap());
            modelBuilder.Configurations.Add(new VendedorMap());
            modelBuilder.Configurations.Add(new VentaMap());
            modelBuilder.Configurations.Add(new Cliente_JuridicoMap());
            modelBuilder.Configurations.Add(new Cliente_NaturalMap());
        }
    }
}
